from Board import Board

class Frame:
    """
    回合帧, 用于保存回合基本信息的数据结构
    """

    def __init__(self, red_player: int, blue_player: int, current_round: int, red_score: int, blue_score: int,
                 current_board: Board, *args, **kw) -> None:
        self.red_player = red_player
        self.blue_player = blue_player
        self.current_round = current_round
        self.red_score = red_score
        self.blue_score = blue_score
        self.current_board = current_board
        """
        其他详细信息由键值对形式传入
        """
        if 'valid_step' in kw:
            self.valid_step = kw['valid_step']
        if 'score_step' in kw:
            self.score_step = kw['score_step']
        if 'other_attr' in kw:
            self.other_attr = kw['other_attr']
        if 'turn_times' in kw:
            self.turn_times = kw['turn_times']
            
    def toggle_round(self, current_player):
        if current_player == self.red_player:
            return self.blue_player
        else:
            return self.red_player